package xyz.ddlnt.servicemgclient.client.fallback;

import org.springframework.cloud.openfeign.FallbackFactory;
import xyz.ddlnt.commonutil.enumeration.ResultCode;
import xyz.ddlnt.commonutil.exception.GlobalException;
import xyz.ddlnt.commonutil.result.Result;
import xyz.ddlnt.model.dto.TechnologyDTO;
import xyz.ddlnt.model.vo.TechnologyInfoVO;
import xyz.ddlnt.model.vo.TechnologySelectVO;
import xyz.ddlnt.model.vo.TechnologyVO;
import xyz.ddlnt.servicemgclient.client.TechnologyFeignClient;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author ZZULI_SE 210910
 * @data 2025/5/1 22:34
 */
public class TechnologyFallbackFactory   implements FallbackFactory<TechnologyFeignClient> {
    @Override
    public TechnologyFeignClient create(Throwable cause) {
        return new TechnologyFeignClient() {

            @Override
            public Result<List<TechnologySelectVO>> selectTechCategoryInfos() {
                throw new GlobalException(ResultCode.THE_REMOTE_PROCEDURE_CALL_FAILED);
            }

            @Override
            public Result<List<TechnologyVO>> selectAll() {
                throw new GlobalException(ResultCode.THE_REMOTE_PROCEDURE_CALL_FAILED);
            }

            @Override
            public Result<List<TechnologyInfoVO>> selectByCategoryId(Long categoryId) {
                throw new GlobalException(ResultCode.THE_REMOTE_PROCEDURE_CALL_FAILED);
            }

            @Override
            public Result<TechnologyInfoVO> selectByTechnologyId(Long technologyId) {
                throw new GlobalException(ResultCode.THE_REMOTE_PROCEDURE_CALL_FAILED);
            }

            @Override
            public Result<TechnologyVO> addTechnology(TechnologyDTO technologyDTO) {
                throw new GlobalException(ResultCode.THE_REMOTE_PROCEDURE_CALL_FAILED);
            }

            @Override
            public Result<LocalDateTime> updateTechnology(TechnologyDTO technologyDTO) {
                throw new GlobalException(ResultCode.THE_REMOTE_PROCEDURE_CALL_FAILED);
            }

            @Override
            public Result<Boolean> deleteTechnology(Long technologyId) {
                throw new GlobalException(ResultCode.THE_REMOTE_PROCEDURE_CALL_FAILED);
            }
        };
    }
}
